package Functii.Trigonometrice;
import Functii.*;
import Operator.*;

public class Cos extends Functie{
	public static double calcul(double aux1){
		return Math.cos(aux1);
	}
	public double calcul(){
		if (fStang == null)
			System.exit(1);
		return calcul(fStang.calcul());
	}
	public String derivare(){
		if (fStang == null)
			System.exit(1);
		return Produs.concatTermens(fStang.derivare(), Sin.concatTermeni(fStang.toString()));
	}
	public String toString(){
		if (fStang == null)
			System.exit(1);
		return concatTermeni(fStang.toString());
	}
	public double calculDerivata(){
		if (fStang == null)
			System.exit(1);
		return Produs.Calcul(fStang.calculDerivata(), Sin.calcul(fStang.calcul()));
	}
	public static String concatTermeni(String aux1){
		String aux;
		int nrP;
		nrP = aux1.charAt(0) == '(' ? 0 : 2;
		aux = "cos";
		if (nrP != 0) aux += "(";
			aux += aux1;
		if (nrP != 0) aux += ")";
			return aux;
	}
}
